package com.zx.callback.common.enums;

/**
 * 订单状态 （-8自动取消（身份位通过验证码） -7后台退票（行程冲突） -6用户发起退票、
 * -5订单过期未完成、-4后台取消订单（未出票）-3用户发起取消订单（未出票）、
 * -2取消订单（未付款）、-1超时未支付、0未付款、1已付款、2购票处理中、
 * 3出票成功、4出票成功已补差价、5已出发
 * @table pay_third_trade.trade_event
 * @author ：yanst
 * @since: 2017/11/23
 * @history：(date editor desc)
 */
public enum OrderStateEnum {

    AUTOMATIC_CANCEL((byte)-8, "自动取消","抢票失败", "查看"),
    BACKSTAGE_REFUND_TICKET((byte)-7, "后台退票（行程冲突）","已取消", "查看"),
    USER_REFUND_TICKET((byte)-6, "用户发起退票","已取消", "查看"),
    ORDER_OVERDUE_UNPAY((byte)-5, "订单过期未完成","抢票失败", "查看"),
    BACKSTAGE_CANCEL((byte)-4, "后台取消订单（未出票）","已取消", "查看"),
    USER_CANCEL((byte)-3, "用户发起取消订单（未出票）","已取消", "查看"),
    ORDER_CANCEL_UNPAY((byte)-2, "取消订单（未付款）","已取消", "查看"),
    OVERTIME_UNPAID((byte)-1, "超时未支付","超时未支付", "查看"),

    UNPAID((byte)0, "未付款","待支付", "支付"),
    ALREADY_PAY((byte)1, "已付款","支付成功", "抢票中"),
    BUYING_TICKET((byte)2, "购票处理中","", "抢票中"),
    BUY_TICKET_SUCCESS((byte)3, "出票成功","抢票成功", "查看"),
    BUY_TICKET_SUCCESS_PREMIUM((byte)4, "出票成功已补差价","抢票成功", "查看"),
    ALREADY_STARTED((byte)5, "已出发","抢票成功", "查看"),
;
    OrderStateEnum(byte  key, String value, String stateName, String butName) {
        this.key = key;
        this.value = value;
        this.stateName = stateName;
        this.butName = butName;
    }

    public static boolean contains(Byte code) {
        if (code != null) {
            for (OrderStateEnum e : OrderStateEnum.values()) {
                if (e.getKey() == code.byteValue()) {
                    return true;
                }
            }
        }
        return false;
    }

    public static OrderStateEnum getNameForKey(Byte code) {
        if (code != null) {
            for (OrderStateEnum e : OrderStateEnum.values()) {
                if (e.getKey() == code.byteValue()) {
                    return e;
                }
            }
        }
        return null;
    }

    private byte key;

    private String value;

    private String stateName;//状态名称

    private String butName;//按钮名称

    public byte getKey() {
        return key;
    }

    public void setKey(byte key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getStateName() {
        return stateName;
    }

    public void setStateName(String stateName) {
        this.stateName = stateName;
    }

    public String getButName() {
        return butName;
    }

    public void setButName(String butName) {
        this.butName = butName;
    }
}
